import time

start = time.time()
with open('m1_sorted.txt', 'r') as file:
    lines = file.readlines()
    a = [int(line) for line in lines]
    for i in range(5000):
        for k in range(4999):
            if a[k] > a[k+1]:
                a[k], a[k+1] = a[k+1], a[k]
finish = time.time()
res = finish - start
res_msec = res * 1000
print('m1_sorted.txt', res_msec, 'milliseconds')


start2 = time.time()
with open('m2_reverse.txt', 'r') as file:
    lines2 = file.readlines()
    b = [int(line) for line in lines]
    for j in range(5000):
        for s in range(4999):
            if b[s] > a[s+1]:
                b[s], b[s+1] = b[s+1], b[s]
finish2 = time.time()
res2 = finish2 - start2
res_msec2 = res2 * 1000
print('m2_reverse.txt', res_msec2, 'milliseconds','\n')


start3 = time.time()
with open('m3_shuffle.txt', 'r') as file:
    lines = file.readlines()
    c = [int(line) for line in lines]
    for i in range(5000):
        for l in range(4999):
            if c[l] > a[l+1]:
                c[l], c[l+1] = c[l+1], c[l]
finish3 = time.time()
res3 = finish3 - start3
res_msec3 = res3 * 1000
print('m3_shuffle.txt', res_msec3, 'milliseconds')
